﻿namespace HySoft.Cash.Business
{
    using Huayou.Common.Database;
    using Huayou.Utils;
    using HySoft.Cash.BaseClass;
    using HySoft.Cash.DB;
    using HySoft.Cash.Structure;
    using System;
    using System.Data;
    using System.Web.UI;

    public class TempinfoBN : BaseBusiness
    {
        private TempinfoDB db;
        private string MODULE_NAME;

        public TempinfoBN(Page page) : base(page)
        {
            this.MODULE_NAME = "____";
            this.db = null;
            this.db = new TempinfoDB(base.curDBOperater);
        }

        public TempinfoBN(Page page, DBOperate oper) : base(page, oper)
        {
            this.MODULE_NAME = "____";
            this.db = null;
            this.db = new TempinfoDB(base.curDBOperater);
        }

        public bool Add(TempinfoDT detail)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Add(detail);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public int AddId(TempinfoDT detail)
        {
            int num = 0;
            try
            {
                try
                {
                    num = this.db.AddId(detail);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return num;
        }

        public bool Delete(int Sid)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Delete(Sid);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public void Dispose()
        {
            base.Dispose();
            if (this.db != null)
            {
                this.db = null;
            }
        }

        public bool Edit(TempinfoDT detail)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Edit(detail);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public TempinfoDT Get(int Sid)
        {
            TempinfoDT odt = null;
            try
            {
                try
                {
                    odt = this.db.Get(Sid);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return odt;
        }

        public DataTable GetList()
        {
            base.DBFieldList = "Sid,OrgSid,OrgEmpSid,EmpName,FirstName,MiddleName,LastName,TaxFileNumber,PayStartDate,PayFrequency,NextPayday,NetPayment,Address1,Address2,PaymentDD,PaymentMM,PaymentYY,NextpayDD,NextpayMM,NextpayYY,IsValid";
            base.DBTable = "tEmpInfo";
            return base.CommonGetList();
        }

        public void QueryAddress1(string Address1)
        {
            if ((Address1 != null) && (Address1.Trim() != ""))
            {
                base.Filter = "Address1 like '%" + StringUtils.ToSQL(Address1) + "%'";
            }
        }

        public void QueryAddress2(string Address2)
        {
            if ((Address2 != null) && (Address2.Trim() != ""))
            {
                base.Filter = "Address2 like '%" + StringUtils.ToSQL(Address2) + "%'";
            }
        }

        public void QueryEmpName(string EmpName)
        {
            if ((EmpName != null) && (EmpName.Trim() != ""))
            {
                base.Filter = "EmpName like '%" + StringUtils.ToSQL(EmpName) + "%'";
            }
        }

        public void QueryFirstName(string FirstName)
        {
            if ((FirstName != null) && (FirstName.Trim() != ""))
            {
                base.Filter = "FirstName like '%" + StringUtils.ToSQL(FirstName) + "%'";
            }
        }

        public void QueryIsValid(int IsValid)
        {
            base.Filter = "IsValid= " + IsValid;
        }

        public void QueryLastName(string LastName)
        {
            if ((LastName != null) && (LastName.Trim() != ""))
            {
                base.Filter = "LastName like '%" + StringUtils.ToSQL(LastName) + "%'";
            }
        }

        public void QueryMiddleName(string MiddleName)
        {
            if ((MiddleName != null) && (MiddleName.Trim() != ""))
            {
                base.Filter = "MiddleName like '%" + StringUtils.ToSQL(MiddleName) + "%'";
            }
        }

        public void QueryNetPayment(decimal NetPayment)
        {
            base.Filter = "NetPayment= " + NetPayment;
        }

        public void QueryNextPayday(string NextPayday)
        {
            if ((NextPayday != null) && (NextPayday.Trim() != ""))
            {
                base.Filter = "NextPayday like '%" + StringUtils.ToSQL(NextPayday) + "%'";
            }
        }

        public void QueryNextpayDD(string NextpayDD)
        {
            if ((NextpayDD != null) && (NextpayDD.Trim() != ""))
            {
                base.Filter = "NextpayDD like '%" + StringUtils.ToSQL(NextpayDD) + "%'";
            }
        }

        public void QueryNextpayMM(string NextpayMM)
        {
            if ((NextpayMM != null) && (NextpayMM.Trim() != ""))
            {
                base.Filter = "NextpayMM like '%" + StringUtils.ToSQL(NextpayMM) + "%'";
            }
        }

        public void QueryNextpayYY(string NextpayYY)
        {
            if ((NextpayYY != null) && (NextpayYY.Trim() != ""))
            {
                base.Filter = "NextpayYY like '%" + StringUtils.ToSQL(NextpayYY) + "%'";
            }
        }

        public void QueryOrgEmpSid(string OrgEmpSid)
        {
            if ((OrgEmpSid != null) && (OrgEmpSid.Trim() != ""))
            {
                base.Filter = "OrgEmpSid like '%" + StringUtils.ToSQL(OrgEmpSid) + "%'";
            }
        }

        public void QueryOrgSid(int OrgSid)
        {
            base.Filter = "OrgSid= " + OrgSid;
        }

        public void QueryPayFrequency(string PayFrequency)
        {
            if ((PayFrequency != null) && (PayFrequency.Trim() != ""))
            {
                base.Filter = "PayFrequency like '%" + StringUtils.ToSQL(PayFrequency) + "%'";
            }
        }

        public void QueryPaymentDD(string PaymentDD)
        {
            if ((PaymentDD != null) && (PaymentDD.Trim() != ""))
            {
                base.Filter = "PaymentDD like '%" + StringUtils.ToSQL(PaymentDD) + "%'";
            }
        }

        public void QueryPaymentMM(string PaymentMM)
        {
            if ((PaymentMM != null) && (PaymentMM.Trim() != ""))
            {
                base.Filter = "PaymentMM like '%" + StringUtils.ToSQL(PaymentMM) + "%'";
            }
        }

        public void QueryPaymentYY(string PaymentYY)
        {
            if ((PaymentYY != null) && (PaymentYY.Trim() != ""))
            {
                base.Filter = "PaymentYY like '%" + StringUtils.ToSQL(PaymentYY) + "%'";
            }
        }

        public void QueryPayStartDate(string PayStartDate)
        {
            if ((PayStartDate != null) && (PayStartDate.Trim() != ""))
            {
                base.Filter = "PayStartDate like '%" + StringUtils.ToSQL(PayStartDate) + "%'";
            }
        }

        public void QuerySid(int Sid)
        {
            base.Filter = "Sid= " + Sid;
        }

        public void QueryTaxFileNumber(string TaxFileNumber)
        {
            if ((TaxFileNumber != null) && (TaxFileNumber.Trim() != ""))
            {
                base.Filter = "TaxFileNumber like '%" + StringUtils.ToSQL(TaxFileNumber) + "%'";
            }
        }
    }
}

